package com.zhangch.base.upload;


import io.swagger.annotations.ApiOperation;
import org.apache.commons.fileupload.servlet.ServletFileUpload;

import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 *
 *流程相关
 * @author chzhang59
 * @date 2020-07-24 11:15:37
 */
@RestController
public class ProcessController  {


    @ApiOperation("大文件分片上传")
    @PostMapping("chunkUpload")
    public void fileChunkUpload(MultipartFileParam param, HttpServletResponse response, HttpServletRequest request){
        /**
         * 判断前端Form表单格式是否支持文件上传
         */
        boolean isMultipart = ServletFileUpload.isMultipartContent(request);
        if(!isMultipart){

            return;
        }
        System.out.println("上传文件 start...");
        try {
            FileManageImpl fileManage = new FileManageImpl();
            String taskId = fileManage.chunkUploadByMappedByteBuffer(param);
        } catch (IOException e) {
        }
        System.out.println("上传文件结束");
    }

}
